{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<style>
    .tishi{
        color: #5cb85c;
        position: absolute;
        z-index: 5;
        left: 550px;
        width: 100%;
        top: 5px;
        font-size: 14px;
    }

</style>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post"
                      enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="box-body">
                        <div class="form-group">
                            <label for="host" class="col-sm-2 control-label">SMTP服务器</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="host" name="host" value="{$data.host|default=''}" placeholder="请输入SMTP服务器" type="text" class="form-control field-text"><span class="tishi" style="color: #5cb85c">SMTP服务器如：smtp.qq.com</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label">邮箱用户名</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="username" name="username" value="{$data.username|default=''}" placeholder="请输入邮箱用户名" type="text" class="form-control field-text"><span class="tishi" style="color: #5cb85c">SMTP用户名（邮箱的用户名）</span>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="password" class="col-sm-2 control-label">授权码</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="password" name="password" value="{$data.password|default=''}" placeholder="请输入授权码" type="text" class="form-control field-text"><span class="tishi" style="color: #5cb85c">SMTP密码或授权码</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="address" class="col-sm-2 control-label">发件邮箱地址</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="address" name="address" value="{$data.address|default=''}" placeholder="请输入发件邮箱地址" type="email" class="form-control field-email"><span class="tishi" style="color: #5cb85c">发件邮箱地址（邮箱）</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">发件人名称</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="name" name="name" value="{$data.name|default=''}" placeholder="请输入发件人名称" type="text" class="form-control field-text"><span class="tishi" style="color: #5cb85c">发件人名称</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">端口号</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="port" name="port" value="{$data.port|default=''}" placeholder="端口号" type="text" class="form-control field-text"><span class="tishi" style="color: #5cb85c">端口号</span>
                            </div>
                        </div>
                    </div>



                    <!-- 表单底部 -->
                    <div class="box-footer">
                        {:token()}
                        <div class="col-sm-2">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            {if !isset($data)}
                            <div class="btn-group pull-right">
                                <label class="createContinue">
                                    <input type="checkbox" value="1" id="_create" name="_create"
                                           title="继续添加数据">继续添加</label>
                            </div>
                            {/if}
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    保存
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>
    /** 表单验证 **/
    $('#dataForm').validate({
        rules: {
            'host': {
                required: true,
            },
            'username': {
                required: true,
            },
            'password': {
                required: true,
            },
            'address': {

            },
            'name': {
                required: true,
            },
        },
        messages: {
            'host': {
                required: 'SMTP服务器不能为空',
            },
            'username': {
                required: "SMTP用户名不能为空",
            },
            'password': {
                required: "SMTP密码或授权码不能为空",
            },
            'address': {
                required: "发件邮箱地址（邮箱）不能为空",
            },
            'name': {
                required: "发件人名称不能为空",
            },
        }
    });
</script>
{/block}